/*
** zomzom.c for zomzom in /home/goupil_r//GameInLab/game1
**
** Made by robin goupil
** Login   <goupil_r@epitech.net>
**
** Started on  Thu Nov 15 18:17:18 2012 robin goupil
** Last update Sun Nov 18 16:22:35 2012 robin goupil
*/

#include <SDL/SDL.h>
#include "include/struct.h"
#include "include/player.h"
#include "include/zombie.h"
#include "include/world.h"
#include "include/utils.h"
#include "include/drawing.h"
#include "include/collision.h"

#define	RESSOURCES	"ressources"
#define IMAGES		RESSOURCES"/images"
#define SOUNDS		RESSOURCES"/sounds"
#define BG_IMG		IMAGES"/bg.bmp"
#define PLAYER_IMG	IMAGES"/player.bmp"
#define ZOMBIE_IMG	IMAGES"/zombie.bmp"
#define RETICLE_IMG	IMAGES"/reticle.bmp"

void		free_frame(t_world *world)
{
  SDL_FreeSurface(world->background);
}

void		frame(t_world *world)
{
  input(world);
  collision(world);
  draw(world);
}

void		start_frame(SDL_Surface *screen)
{
  t_world	*world;

  world = create_world(BG_IMG, 1980, 1600, screen);
  put_reticle_in_world(world,
		       create_reticle(new_sprite(RETICLE_IMG, 32), new_vec(100, 100)));
  put_player_in_world(world,
		      create_player(new_sprite(PLAYER_IMG, 32), new_vec(750, 100)));
  put_zombie_in_world(world,
		      create_zombie(new_sprite(ZOMBIE_IMG, 32), new_vec(350, 100), 1, 100));
  put_zombie_in_world(world,
		      create_zombie(new_sprite(ZOMBIE_IMG, 32), new_vec(500, 100), 1, 100));
  put_zombie_in_world(world,
		      create_zombie(new_sprite(ZOMBIE_IMG, 32), new_vec(150, 100), 1, 100));
  while (1)
    frame(world);
  free_frame(world);
}
